describe('practice-2-3', function () {

    it("分糖果问题", function () {
        var arr_sweet = [10,2,8,22,16,4,10,6,14,20];
        var result = split_sweets(arr_sweet);
        var arr_key = ['count','one','two','thr','fou','fiv','six','sev','eig','nin','ten'];

        expect(result.length).toBe(18);
        expect((result[result.length-1]).count).toBe(17);
        for(var i = 1; i < arr_key.length; i ++)
        {
            var key = arr_key[i];
            expect(result[result.length-1][key]).toBe(18);
        }
        for(var i = 1; i < arr_key.length; i ++)
        {
            var key = arr_key[i];
            if(i===7||i===8)
            {
                expect(result[16][key]).toBe(17);
            }
            else
            {
                expect(result[16][key]).toBe(18);
            }
        }
    });

});